import React from 'react'
import './index.scss'
import { useLoading } from '@/context/loading'

const Loading = (props) => {
  const { fixed = true } = props
  const { loadingState } = useLoading()
  return loadingState ? (
    <div className={`loading-wrap ${fixed ? 'fixed' : ''}`}>
      <div className="loading">
        <div className="box">
          <div className="line"></div>
          <div className="line"></div>
          <div className="line"></div>
          <div className="line"></div>
          <div className="line"></div>
          <div className="line"></div>
        </div>
      </div>
    </div>
  ) : null
}

export default Loading
